/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.icatportal.client.mvc;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.View;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import org.icatportal.client.AppEvents;
import org.icatportal.client.widget.DataPanel;

/**
 *
 * @author ll56
 */
public class SearchView extends View {

    private LayoutContainer container;
  private DataPanel panel;

  public SearchView(Controller controller) {
    super(controller);
  }

   @Override
    protected void initialize() {
        container = new LayoutContainer();

        BorderLayout layout = new BorderLayout();
        layout.setEnableState(false);
        container.setLayout(layout);
        panel = new DataPanel();

        container.add(panel, new BorderLayoutData(LayoutRegion.CENTER));

    }

  @Override
  protected void handleEvent(AppEvent event) {
    if (event.type == AppEvents.MyData) {
      LayoutContainer wrapper = (LayoutContainer) Registry.get("center");
      wrapper.removeAll();
      wrapper.add(panel);
      wrapper.layout();
    }
  }
}

